import {
  WHETHER_OPTION,
  STOCK_ATTR_OPTION,
  SIGN_CONTRACT_OPTION,
  SUPPLIER_CLASSIFY_OPTIONS,
  ISSYNERGY_OPTION
} from '../../constants';
import { querySaleCompanyService } from '@/api/sourcing/public'
export const INQUIRY_TYPE = [
  {
    label: '客户询价',
    value: '1'
  },
  {
    label: '订货询价',
    value: '2'
  },
  {
    label: '自进货询价',
    value: '3'
  },
]

export const initFormItems = (areaList) => {
  return [
    {
      prop: 'billType',
      label: '询价类型',
      type: 'select',
      options: INQUIRY_TYPE
    },
    {
      prop: 'inquiryDate',
      label: '询价日期',
      type: 'dateTimeRangePicker'
    },
    {
      prop: 'sourceBillNo',
      label: '采购询价单号',
      type: 'input'
    },
    {
      prop: 'purchaseInquirerCompanyName',
      label: '采购询价部门',
      type: 'input'
    },
    {
      prop: 'purchaseInquirerName',
      label: '采购询价人',
      type: 'input'
    },
    {
      prop: 'supplierName',
      label: '供应商名称',
      type: 'input'
    },
    {
      prop: 'supplierCode',
      label: '供应商代码',
      type: 'input'
    },
    {
      prop: 'skuCode',
      label: '商品代码',
      type: 'input'
    },
    {
      prop: 'skuName',
      label: '商品名称',
      type: 'input'
    },
    {
      prop: 'winBidding',
      label: '是否中标',
      type: 'select',
      options: SIGN_CONTRACT_OPTION
    },
    {
      prop: 'bidingDate',
      label: '定标日期',
      type: 'dateTimeRangePicker',
    },
    {
      prop: 'serviceProviderName',
      label: '指定渠道名称',
      type: 'input'
    },
    {
      prop: 'isProcedures',
      label: '是否走手续',
      type: 'select',
      options: WHETHER_OPTION
    },
    {
      prop: 'isServiceProvider',
      label: '是否服务商',
      type: 'select',
      options: WHETHER_OPTION
    },
    {
      prop: 'stockAttr',
      label: '存量属性',
      type: 'select',
      options: STOCK_ATTR_OPTION
    },
    {
      prop: 'signContract',
      label: '是否签合同',
      type: 'select',
      options: SIGN_CONTRACT_OPTION
    },
    {
      prop: 'categoryCode',
      label: '分类',
      type: 'category',
    },
    {
      prop: 'validityDate',
      label: '价格有效期',
      type: 'dateTimeRangePicker',
    },
    {
      prop: 'isPriceExpireTime',
      label: '价格有效期内',
      type: 'select',
      options: SIGN_CONTRACT_OPTION,
    },
    {
      prop: 'priceLowest',
      label: '是否价格最低',
      type: 'select',
      options: SIGN_CONTRACT_OPTION,
    },
    {
      prop: 'saleCompanyId',
      label: '销售公司',
      type: 'select',
      remote: true,
      remoteMethod: querySaleCompanyService,
      paramKey: 'companyName',
      optionKeys: { valueKey: 'companyId', labelKey: 'companyName' },
    },
    {
      prop: 'saleAreaId',
      label: '销售区域',
      type: 'select',
      options: areaList
    },
    {
      prop: 'onlineCollaboration',
      label: '单据是否协同',
      type: 'select',
      options: ISSYNERGY_OPTION,
    },
    {
      prop: 'supplierStatus',
      label: '供应商分类',
      type: 'select',
      options: SUPPLIER_CLASSIFY_OPTIONS,
    },
    {
      prop: 'emergencyOrder',
      label: '是否紧急订货',
      type: 'select',
      options: SIGN_CONTRACT_OPTION
    },
  ]
}

export const TABLE_COLUMNS = [
  {
    prop: 'billTypeStr',
    label: '询价类型',
  },
  {
    prop: 'sourceBillNo',
    label: '采购询价单号',
    width: 140
  },
  {
    prop: 'inquiryDate',
    label: '询价日期',
    width: 140
  },
  {
    prop: 'bidingDate',
    label: '定标日期',
  },
  {
    prop: 'purchaser',
    label: '采购询价部门',
    width: 140
  },
  {
    prop: 'purchaseInquirerName',
    label: '采购询价人',
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
  },
  {
    prop: 'supplierCode',
    label: '供应商代码',
  },
  {
    prop: 'supplierStatusStr',
    label: '供应商分类',
    width: 100
  },
  {
    prop: 'onlineCollaborationStr',
    label: '单据是否协同',
  },
  {
    prop: 'freightPayerName',
    label: '运费承担方',
  },
  {
    prop: 'freightPrice',
    label: '运费',
  },
  {
    prop: 'invoiceTypeStr',
    label: '发票类型',
  },
  {
    prop: 'taxRateVal',
    label: '税率',
  },
  {
    prop: 'bidderOrNotStr',
    label: '是否中标',
  },
  {
    prop: 'recommendSupplierStr',
    label: '推荐供应商',
    width: 120,
  },
  {
    prop: 'orderReason',
    label: '未使用推荐供应商原因',
    width: 150,
  },
  {
    prop: 'signContractStr',
    label: '是否签合同',
    width: 100,
  },
  {
    prop: 'noSignContractReason',
    label: '未签合同原因',
    width: 100,
  },
  {
    prop: 'pushOrNotStr',
    label: '是否下推采购订单',
    width: 120,
  },
  {
    prop: 'purchaseOrderCode',
    label: '采购订单号',
  },
  {
    prop: 'stockAttrStr',
    label: '存量属性',
  },
  {
    prop: 'factoryCode',
    label: '厂家商品代码',
    width: 100
  },
  {
    prop: 'factoryName',
    label: '厂家商品名称',
    width: 100
  },
  {
    prop: 'skuCode',
    label: '商品代码',
  },
  {
    prop: 'skuName',
    label: '商品名称',
  },
  {
    prop: 'categoryCode',
    label: '分类代码',
  },
  {
    prop: 'categoryName',
    label: '分类名称',
  },
  {
    prop: 'skuSpecifications',
    label: '规格',
  },
  {
    prop: 'skuUnit',
    label: '主计量单位',
  },
  {
    prop: 'assistSkuUnit',
    label: '辅计量单位',
  },
  {
    prop: 'skuNum',
    label: '报价主数量',
  },
  {
    prop: 'assistSkuNum',
    label: '报价辅数量',
  },
  {
    prop: 'numOfBids',
    label: '中标主数量',
  },
  {
    prop: 'isProceduresStr',
    label: '是否走手续',
    width: 100
  },
  {
    prop: 'isServiceProviderStr',
    label: '是否服务商',
    width: 100
  },
  {
    prop: 'serviceProviderName',
    label: '指定渠道名称',
    width: 120
  },
  {
    prop: 'unitPrice',
    label: '主进价',
  },
  {
    prop: 'assistUnitPrice',
    label: '辅进价',
  },
  {
    prop: 'deliveryDate',
    label: '交货期',
  },
  {
    prop: 'workableArrivalTime',
    label: '落实到货时间',
    width: 110,
  },
  {
    prop: 'shippingCompanyName',
    label: '发货公司',
  },
  {
    prop: 'receiveCompanyName',
    label: '收货公司',
  },
  {
    prop: 'remark',
    label: '采购备注',
  },
  {
    prop: 'costPrice',
    label: '成本价',
  },
  {
    prop: 'totalPrice',
    label: '小计',
  },
  {
    prop: 'priceExpireTime',
    label: '价格有效期',
  },
  {
    prop: 'isPriceExpireTimeStr',
    label: '是否价格有效期内',
    width: 120
  },
  {
    prop: 'priceLowestStr',
    label: '是否价格最低',
    width: 100
  },
  {
    prop: 'saleCompanyName',
    label: '销售公司名称',
    width: 100
  },
  {
    prop: 'saleAreaName',
    label: '销售区域',
  },
  {
    prop: 'emergencyOrderStr',
    label: '是否紧急订货',
    width: 110
  },
]
